<%@page import="doan.quanlycanbo.portlet.model.impl.hesoluongImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.ngachluongImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.giaoducphothongImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.xuatthanImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.tongiaoImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.dantocImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.danhhieuImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.capuyImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.hocviImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.hochamImpl"%>
<%@page import="doan.quanlycanbo.portlet.model.impl.khoidonviquanlyImpl"%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="com.liferay.portal.service.permission.PortletPermissionUtil" %>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portal.kernel.util.ListUtil"%>

<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="doan.quanlycanbo.portlet.util.PortletKeysExt" %>

<%@page import="doan.quanlycanbo.portlet.model.capuy" %>
<%@page import="doan.quanlycanbo.portlet.service.capuyLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.danhhieu" %>
<%@page import="doan.quanlycanbo.portlet.service.danhhieuLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.dantoc" %>
<%@page import="doan.quanlycanbo.portlet.service.dantocLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.giaoducphothong" %>
<%@page import="doan.quanlycanbo.portlet.service.giaoducphothongLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.hesoluong" %>
<%@page import="doan.quanlycanbo.portlet.service.hesoluongLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.hocham" %>
<%@page import="doan.quanlycanbo.portlet.service.hochamLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.hocvi" %>
<%@page import="doan.quanlycanbo.portlet.service.hocviLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.khoidonviquanly" %>
<%@page import="doan.quanlycanbo.portlet.service.khoidonviquanlyLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.ngachluong" %>
<%@page import="doan.quanlycanbo.portlet.service.ngachluongLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.tongiao" %>
<%@page import="doan.quanlycanbo.portlet.service.tongiaoLocalServiceUtil" %>
<%@page import="doan.quanlycanbo.portlet.model.xuatthan" %>
<%@page import="doan.quanlycanbo.portlet.service.xuatthanLocalServiceUtil" %>


<portlet:defineObjects/>
<liferay-theme:defineObjects />

<%
	int typeGeneral = Integer.valueOf(request.getParameter("typeGeneral")) ;

	String idGeneralS = request.getParameter("idGeneral");
%>
<portlet:actionURL name="updateGeneral" var="updateGeneralURL"/>

<!-- KHOI DON VI -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_KHOIDV %>">
	<%	
		khoidonviquanly kdv = new khoidonviquanlyImpl();
		if(idGeneralS != null){
			kdv = khoidonviquanlyLocalServiceUtil.getkhoidonviquanly(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr>
				<td>Ten khoi: </td>
				<td><aui:input name="tenkhoi" value="<%=kdv.getTenkhoi() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
	
</c:if>

<!-- HOC HAM -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_HOCHAM %>">
	<%	
		hocham hocHam = new hochamImpl();
		if(idGeneralS != null){
			hocHam = hochamLocalServiceUtil.gethocham(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Hoc ham: </td>
				<td><aui:input name="tenhocham" value="<%=hocHam.getTenhocham() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- HOC VI -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_HOCVI %>">
	<%	
		hocvi hocVi = new hocviImpl();
		if(idGeneralS != null){
			hocVi = hocviLocalServiceUtil.gethocvi(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Hoc vi: </td>
				<td><aui:input name="tenhocvi" value="<%=hocVi.getTenhocvi() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- CAP UY -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_CAPUY %>">
	<%	
		capuy capUy = new capuyImpl();
		if(idGeneralS != null){
			capUy = capuyLocalServiceUtil.getcapuy(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Cap Uy: </td>
				<td><aui:input name="tencapuy" value="<%=capUy.getTencapuy() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- DANH HIEU -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_DANHHIEU %>">
	<%	
		danhhieu danhHieu = new danhhieuImpl();
		if(idGeneralS != null){
			danhHieu = danhhieuLocalServiceUtil.getdanhhieu(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Danh Hieu: </td>			
				<td><aui:input name="tendanhhieu" value="<%=danhHieu.getTendanhhieu()%>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- DAN TOC -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_DANTOC %>">
	<%	
		dantoc danToc = new dantocImpl();
		if(idGeneralS != null){
			danToc = dantocLocalServiceUtil.getdantoc(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Dan toc: </td>
				<td><aui:input name="tendantoc" value="<%=danToc.getTendantoc() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!--  TON GIAO -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_TONGIAO %>">
	<%	
		tongiao tonGiao = new tongiaoImpl();
		if(idGeneralS != null){
			tonGiao = tongiaoLocalServiceUtil.gettongiao(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Ton giao: </td>
				<td><aui:input name="tentongiao" value="<%=tonGiao.getTentongiao() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- XUAT THAN -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_XUATTHAN %>">
	<%	
		xuatthan xuatThan = new xuatthanImpl();
		if(idGeneralS != null){
			xuatThan = xuatthanLocalServiceUtil.getxuatthan(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Xuat than: </td>
				<td><aui:input name="tenxuatthan" value="<%=xuatThan.getTenxuatthan() %>" label=""/></td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- GIAO DUC PHO THONG -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_GDPT %>">
	<%	
		giaoducphothong gdpt = new giaoducphothongImpl();
		if(idGeneralS != null){
			gdpt = giaoducphothongLocalServiceUtil.getgiaoducphothong(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
			<tr height="30">
				<td>Giao duc pho thong: </td>
				<td>
					<aui:input name="tengdpt" value="<%= gdpt.getTengdpt() %>" label=""/>
				</td>
			</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- NGACH LUONG -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_NGACHLUONG %>">
	<%	
		ngachluong ngachLuong = new ngachluongImpl();
		if(idGeneralS != null){
			ngachLuong = ngachluongLocalServiceUtil.getngachluong(Long.valueOf(idGeneralS));
		}
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>
		<table>
		<tr height="30">
			<td>Ma ngach luong: </td>
			<td><aui:input name="mangachluong" value='<%= (ngachLuong.getMabangngachluong() > 0 ? ngachLuong.getMangachluong() : "" )%>' label=""/>
			</td>
		</tr>
		<tr height="30">
			<td>Ngach luong: </td>
			<td><aui:input name="tenngachluong" value="<%= ngachLuong.getTenngachluong() %>" label=""/></td>
		</tr>
		</table>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>

<!-- HE SO LUONG -->
<c:if test="<%= typeGeneral == PortletKeysExt.ADD_HESOLUONG %>">
	<%	
		hesoluong hsl = new hesoluongImpl();
		if(idGeneralS != null){
			hsl = hesoluongLocalServiceUtil.gethesoluong(Long.valueOf(idGeneralS));
		}
		
		List<ngachluong> ngachLuongList = ngachluongLocalServiceUtil.getAll();
	%>
	<aui:form Method="post" name="fm" action="<%= updateGeneralURL.toString() %>">
		<aui:input name="typeGeneral" value="<%= typeGeneral %>" type="hidden"/>
		<aui:input name="idGeneral" value="<%= idGeneralS %>" type="hidden"/>	
		<table>
			<tr height="30px">		
				<td>He so luong: </td>
				<td><aui:input name="hesoluong" value='<%= (hsl.getMahesoluong() > 0 ? hsl.getHesoluong() : "" ) %>' label=""/>
				</td>
			</tr>
			<tr height="30px">
				<td>Bac luong: </td>
				<td>
				<aui:select name="bacluong" label="">
					<aui:option value="1" selected="<%= hsl.getBacluong() == 1%>">1</aui:option>
					<aui:option value="2" selected="<%= hsl.getBacluong() == 2%>">2</aui:option>
					<aui:option value="3" selected="<%= hsl.getBacluong() == 3%>">3</aui:option>
				</aui:select>
				</td>
			</tr>
			<tr height="30px">
				<td>Ngach luong: </td>
				<td>
				<aui:select name="ngachluong" label="">
					<%for(ngachluong ngachLuong : ngachLuongList) {%>
						<aui:option value="<%= ngachLuong.getMangachluong() %>" selected="<%= hsl.getMangachluong() == ngachLuong.getMangachluong() %>"><%= ngachLuong.getTenngachluong() %></aui:option>
					<%} %>
				</aui:select>
				</td>
			</tr>
		</table>
		<br/><br/>
		<aui:button type="submit" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.save","Luu") %>'/>
		<aui:button type="button" value='<%=LanguageUtil.get(pageContext, "managecontacts.agency.add-button.cancel","Thoat") %>' onClick="history.back();"/>	
	</aui:form>
</c:if>








